<?php
/**
 * Created by PhpStorm.
 * User: xiong <1099446868@qq.com>
 * DateTime: 2018/11/9
 * TIME: 20:22
 */

namespace app\admin\controller;


use think\Db;

class Admin extends BaseController {

    public function admin(){
        return $this->fetch();
    }

    public function index() {
        return $this->fetch('index');
    }

    public function index2() {
        return $this->fetch('index2');
    }

    public function getBookInfoForMobileIndex(){
        $tui = Db::name('mobile_tuijian')->select();
        foreach($tui as $k=>$v){
            $book = Db::name('bookname')->where('bookname', $v['bookname'])->find();
            if(!empty($book)){
                Db::name('mobile_tuijian')->where('bookname', $book['bookname'])->update([
                    'bid'=>$book['id'],
                    'author'=>$book['author'],
                    'desc'=>$book['desc'],
                    'img'=>$book['img']
                ]);
            }
        }
    }
}